package com.cw.carwashclients.service.impl;

import com.cw.carwashclients.domain.Customers;
import com.cw.carwashclients.mapper.CustomersMapper;
import com.cw.carwashclients.service.CustomersService;
import com.ruoyi.common.core.context.SecurityContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CustomersServiceImpl implements CustomersService {

    @Autowired
    private CustomersMapper customersMapper;

    @Override
    public List<Customers> selectCustomersList(Customers customers) {
         return customersMapper.selectCustomersList(customers);
    }

    @Override
    public Long selectCustomersCount(Customers customers) {
         return customersMapper.selectCustomersCount(customers);
    }

    @Override
    public Customers selectCustomersById(Long id) {
        return customersMapper.selectCustomersById(id);
    }

    @Override
    public int insertCustomers(Customers customers) {
        customers.setCreatedAt(new Date());
        return customersMapper.insertCustomers(customers);
    }

    @Override
    public int updateCustomers(Customers customers) {
         customers.setUpdatedAt(new Date());
         return customersMapper.updateCustomers(customers);
    }

    @Override
    public int deleteCustomersById(Long id) {
        return customersMapper.deleteCustomersById(id);
    }

    @Override
    public int deleteCustomersByIds(Long[] ids) {
        return customersMapper.deleteCustomersByIds(ids);
    }
}
